home *** CD-ROM | disk | FTP | other *** search
/ MacHack 2000 / MacHack 2000.toast / pc / The Hacks / Genie / Projects / AEA / Source / Sources / Tokens / AEATokenDescList.cc < prev    next >
Encoding:
C/C++ Source or Header  |  2000-06-24  |  928 b   |  50 lines

  1. /*    ===================
  2.  *    AEATokenDescList.cc
  3.  *    ===================
  4.  */
  5.  
  6. #include "AEADebugging.h"
  7.  
  8. #include <Errors.h>
  9.  
  10. #include "AEAMetatoken.hh"
  11. #include "AEATokenDescList.hh"
  12.  
  13.  
  14. AEATokenDescList::AEATokenDescList(AEDesc inAEDesc)
  15. {
  16.     mDescList.Duplicate(inAEDesc);
  17. }
  18.  
  19. AEATokenDescList::~AEATokenDescList()
  20. {
  21. }
  22.  
  23. void
  24. AEATokenDescList::MakeDataDescriptor(AEDesc &outAEDesc)
  25. {
  26.     if (mDescList.DescriptorType() == typeAEList) {
  27.         // create output list
  28.         AEADescList list;
  29.         
  30.         list.Create();
  31.         
  32.         long count = mDescList.CountItems();
  33.         for (int i = 1; i <= count; i++) {
  34.             AEADesc item;
  35.             mDescList.Get(i, item.Ref());
  36.             // make a descriptor for item
  37.             AEAMetatoken token(item.Ref());
  38.             AEADesc desc;
  39.             token.Ref().MakeDataDescriptor(desc.Ref());
  40.             // add it to the list
  41.             list.Put(0, desc.Ref());
  42.             // dispose of anything
  43.         }
  44.         outAEDesc = list.Ref();
  45.         list.Reset();
  46.     } else {
  47.         ThrowOSErr_(errAEEventNotHandled);
  48.     }
  49. }
  50.